<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-control" content="no-cache">

	<%-- CSS Style Declarations --%>
	<link rel ="stylesheet" type="text/css" href="stylesheets/style.css" ></link>
	
		<%-- Java imports --%>
	<%@ page import="java.io.*" %>
	<%@ page import="java.util.*" %>
	<%@ page import="flashcardtest.FlashCardSet" %>
	<%@ page import="flashcardtest.FlashCard" %>
	<%@ page import="flashcardtest.FlashCardCore" %>
	<%@ page import="com.google.appengine.api.users.UserService" %>
	<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
	
	
	<%-- Get reference to Java Objects --%>
	<% 	FlashCardCore core = (FlashCardCore) request.getSession().getAttribute("core");
		if (core == null) {
			core = new FlashCardCore();
			request.getSession().setAttribute("core", core);
		}
		%>
	<%-- Detect User Logged In --%>
	<%
		if (!core.loggedIn()){
			response.sendRedirect("/login.jsp");
		}
	  	%>
	

<title>Look Up</title>
</head>

<body>

<div id="center-column">

<!-- Header -->
<div id="header">
<FORM action="tomain" method="post">
			<input
				type="submit"
				name="button1"
				class="headerbutton"
				value="Main Menu"
				title="">
</FORM>
</div> <!-- header -->
<!-- User name -->
<div id="user_name">
	<% out.println( core.getUserName() + 
			" (<a href=\"" + core.getLogoutURL(request) +
			"\">sign out</a>)"); %>
</div> <!-- /user name -->

<!-- Dictionary Title -->
<div id="set_name">
	<% out.println(core.getSetName());%>
</div> <!-- dictionary title -->


<!-- Lookup Title 1 -->
<div style="
	font-size:30px;
	width: 600px;
	text-align:center;
	position:absolute;
	top:50px;
	">
	<% out.println(core.getFlashCardSet().getCategory1() + " to " + core.getFlashCardSet().getCategory2()); %>
</div> <!-- lookup title 1 -->

<!-- Lookup 1 -->
<div style="
	position:absolute;
	top:100px;
	left:0px;
	width:600px;
	text-align:center;
	">
<form action="lookup" method="post">
<% out.println(core.getFlashCardSet().getCategory1() + ":"); %>
<input type="text" class="text" size="15" maxlength="20" name="entry" />
<input type="submit" name="whichkey" value="key1" /><br>
<textarea rows="4" cols="30" readonly="readonly">
<% out.println(request.getSession().getAttribute("response1")); %>
</textarea>
	
</form>
</div> <!-- lookup 1 -->

<!-- Lookup Title 2 -->
<div style="
	font-size:30px;
	width: 600px;
	text-align:center;
	position:absolute;
	top:230px;
	">
	<% out.println(core.getFlashCardSet().getCategory2() + " to " + core.getFlashCardSet().getCategory1()); %>
	</div> <!-- lookup title 2 -->

<!-- Lookup 2 -->
<div style="
	position:absolute;
	top:280px;
	left:0px;
	width:600px;
	text-align:center;
	">
<form action="lookup" method="post">
<% out.println(core.getFlashCardSet().getCategory2() + ":"); %>  
<input type="text" class="text" size="15" maxlength="20" name="entry" />
<input type="submit" name="whichkey" value="key2" /><br>
<textarea rows="4" cols="30" readonly="readonly">
<% out.println(request.getSession().getAttribute("response2")); %>
</textarea>
</form>
	</div> <!-- lookup 2 -->

</div> <!-- center-column -->
</body>
</html>